package a.a;

import a.c.d;
import a.c.e;
import a.c.k;
import a.c.n;
import a.c.q;
import a.c.w;
import a.c.*;
import a.i.db;

import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;

class ib
{
  private static void a(List paramList, n paramn)
  {
    int i = m.b;
    boolean bool = m.a;
    ListIterator localListIterator = paramList.listIterator();
    label78:
    do
    {
      d locald;
      do
      {
        if (!localListIterator.hasNext()) {
          return;
        }
        locald = (d)localListIterator.next();
        if (i != 0) {
          break label78;
        }
        if (locald.e().c() == 1) {
          break;
        }
        if (i != 0) {
          break label78;
        }
      } while (locald.f().c() != 1);
      paramn.a(locald, 0.0D);
    } while (!bool);
  }
  
  private void a(q paramq, d[] paramArrayOfd)
  {
    int j = m.b;
    boolean bool = m.a;
    do
    {
      int i = paramArrayOfd.length - 1;
      while (!bool)
      {
        if (i < 0) {
          break;
        }
        if (j == 0)
        {
          if (!paramq.j(paramArrayOfd[i])) {
            paramq.g(paramArrayOfd[i]);
          }
          i--;
        }
      }
    } while (j != 0);
  }
  
  private void a(q paramq, x paramx1, x paramx2)
  {
    int i = m.b;
    boolean bool = m.a;
    w localw = paramq.v();
    do
    {
      while (!bool)
      {
        if (!localw.e()) {
          break;
        }
        paramx2.a(localw.d(), paramx1.getInt(localw.d()));
        localw.f();
      }
    } while (i != 0);
  }
  
  private static ArrayList a(List paramList)
  {
    int i = m.b;
    boolean bool = m.a;
    ArrayList localArrayList = new ArrayList();
    do
    {
      ListIterator localListIterator = paramList.listIterator();
      while (locald == null)
      {
        if (!localListIterator.hasNext()) {
          break;
        }
        e locale = (e)localListIterator.next();
        locald = locale.h();
      }
      if ((i != 0) || (bool)) {
        break label95;
      }
      localArrayList.add(locald);
      d locald = locald.i();
    } while ((i == 0) && ((!bool) && (!bool)));
    label95:
    return localArrayList;
  }
  
  private void b(List paramList, n paramn)
  {
    int i = m.b;
    boolean bool = m.a;
    do
    {
      ListIterator localListIterator = paramList.listIterator();
      while (!bool)
      {
        if (!localListIterator.hasNext()) {
          break;
        }
        paramn.a(localListIterator.next(), 0.0D);
      }
    } while (i != 0);
  }
  
  private ArrayList a(ArrayList paramArrayList)
  {
    int i = m.b;
    boolean bool = m.a;
    ArrayList localArrayList = new ArrayList();
    do
    {
      ListIterator localListIterator = paramArrayList.listIterator();
      while (!bool)
      {
        if (!localListIterator.hasNext()) {
          break;
        }
        if (bool) {
          break label59;
        }
        localArrayList.add(localListIterator.next());
      }
    } while (i != 0);
    label59:
    return localArrayList;
  }
  
  private List a(q paramq, x paramx, int paramInt)
  {
    int j = m.b;
    boolean bool = m.a;
    ArrayList localArrayList = new ArrayList();
    int i = 0;
    do
    {
      do
      {
        if (i >= paramInt) {
          break;
        }
        localArrayList.add(new ArrayList());
        i++;
        if ((j == 0) && (bool)) {
          break label134;
        }
      } while (!bool);
    } while (j != 0);
    if (paramInt == 1)
    {
      localw = paramq.v();
      do
      {
        while (!bool)
        {
          if (!localw.e()) {
            break;
          }
          if (bool) {
            break label133;
          }
          ((ArrayList)localArrayList.get(0)).add(localw.d());
          localw.f();
        }
      } while (j != 0);
      label133:
      return localArrayList;
    }
    label134:
    w localw = paramq.v();
    do
    {
      while (!bool)
      {
        if (!localw.e()) {
          break;
        }
        if (bool) {
          break label208;
        }
        ((ArrayList)localArrayList.get(paramx.getInt(localw.d()))).add(localw.d());
        localw.f();
      }
    } while (j != 0);
    label208:
    return localArrayList;
  }
  
  private double a(d[] paramArrayOfd, x paramx, int paramInt, boolean paramBoolean)
  {
    int i2 = m.b;
    boolean bool = m.a;
    double[][] arrayOfDouble = new double[paramInt][paramInt];
    int i = paramArrayOfd.length;
    if (i2 == 0) {
      if (paramBoolean)
      {
        j = i - 1;
        do
        {
          if (j < 0) {
            break;
          }
          k = paramx.getInt(paramArrayOfd[j].e());
          m = paramx.getInt(paramArrayOfd[j].f());
          arrayOfDouble[k][m] += 1.0D;
          j--;
        } while (!bool);
      }
    }
    int j = i - 1;
    do
    {
      do
      {
        if (j < 0) {
          break;
        }
        k = paramx.getInt(paramArrayOfd[j].e());
        m = paramx.getInt(paramArrayOfd[j].f());
        arrayOfDouble[k][m] += 1.0D;
        arrayOfDouble[m][k] += 1.0D;
        j--;
        if (i2 != 0) {
          break label206;
        }
        if (bool) {
          break label204;
        }
      } while (!bool);
    } while (i2 != 0);
    j = paramInt - 1;
    label204:
    label206:
    while (i2 != 0)
    {
      int k;
      int m;
      while (!bool)
      {
        if (j < 0) {
          break;
        }
        arrayOfDouble[j][j] /= 2.0D;
        j--;
      }
    }
    double d1 = 0.0D;
    double d2 = 0.0D;
    int n = paramInt - 1;
    if (n >= 0) {
      d1 += arrayOfDouble[n][n];
    }
    do
    {
      double d3 = 0.0D;
      if (i2 != 0) {
        break label393;
      }
      double d4 = 0.0D;
      if (bool) {
        break label388;
      }
      int i1 = paramInt - 1;
      if (i1 >= 0)
      {
        d3 += arrayOfDouble[n][i1];
        d4 += arrayOfDouble[i1][n];
        i1--;
      }
      for (;;)
      {
        if (i2 == 0) {
          if (!bool)
          {
            if (!bool) {
              break;
            }
            d2 += d3 * d4;
            if (i2 != 0) {
              continue;
            }
            n--;
          }
        }
      }
      if (!bool) {
        break;
      }
      d1 /= i;
    } while (i2 != 0);
    d2 /= i * i;
    label388:
    label393:
    return d1 - d2;
  }
  
  private int a(q paramq, List paramList1, x paramx, List paramList2, int paramInt)
  {
    int j = m.b;
    boolean bool = m.a;
    boolean[] arrayOfBoolean = new boolean[paramq.j()];
    m.a(paramq, (e)paramList1.get(0), false, arrayOfBoolean);
    ListIterator localListIterator1 = paramList1.listIterator();
    while (localListIterator1.hasNext()) {
      if (arrayOfBoolean[((e)localListIterator1.next()).f()] == 0)
      {
        ArrayList localArrayList1 = new ArrayList();
        ArrayList localArrayList2 = (ArrayList)paramList2.get(paramx.getInt((e)paramList1.get(0)));
        ListIterator localListIterator2 = paramList1.listIterator();
        do
        {
          int i;
          do
          {
            e locale;
            do
            {
              if (!localListIterator2.hasNext()) {
                break;
              }
              locale = (e)localListIterator2.next();
            } while (arrayOfBoolean[locale.f()] != 0);
            paramx.a(locale, paramInt);
            localArrayList1.add(locale);
            i = localArrayList2.indexOf(locale);
            if (j != 0) {
              break label229;
            }
            if (bool) {
              break label230;
            }
          } while (i < 0);
          localArrayList2.remove(i);
          if (j != 0) {
            break label228;
          }
        } while (!bool);
        paramList2.add(localArrayList1);
        label228:
        label229:
        label230:
        return paramInt + 1;
      }
    }
    return paramInt;
  }
  
  private b_ c(List paramList, n paramn)
  {
    int i = m.b;
    boolean bool = m.a;
    double d = -1.797693134862316E+308D;
    b_ localb_ = new b_(null);
    localb_.a = -1.0D;
    ListIterator localListIterator = paramList.listIterator();
    do
    {
      do
      {
        d locald;
        do
        {
          if (!localListIterator.hasNext()) {
            break;
          }
          locald = (d)localListIterator.next();
        } while (paramn.getDouble(locald) <= d);
        d = paramn.getDouble(locald);
        localb_.a = paramn.getDouble(locald);
        if (i == 0)
        {
          if ((i != 0) || (bool)) {
            break label131;
          }
          localb_.c = locald;
        }
      } while (i != 0);
    } while (!bool);
    label131:
    return localb_;
  }
  
  private d a(List paramList1, List paramList2, n paramn, x paramx, boolean paramBoolean, int paramInt)
  {
    int i = m.b;
    boolean bool = m.a;
    d locald1 = null;
    if ((i != 0) || (paramInt != -1))
    {
      double d1;
      Object localObject;
      if (!paramBoolean)
      {
        d1 = -1.797693134862316E+308D;
        b_ localb_2 = new b_(null);
        localb_2.a = -1.0D;
        localListIterator1 = paramList2.listIterator();
        do
        {
          do
          {
            do
            {
              if (!localListIterator1.hasNext()) {
                break;
              }
              localObject = (d)localListIterator1.next();
            } while (paramn.getDouble(localObject) <= d1);
            d1 = paramn.getDouble(localObject);
            localb_2.a = d1;
            localb_2.c = ((d)localObject);
            if ((i != 0) || (i != 0)) {
              break label158;
            }
            if (bool) {
              break label156;
            }
          } while (i != 0);
        } while (!bool);
        paramList1.set(paramInt, localb_2);
        label156:
        label158:
        if (!bool) {}
      }
      else
      {
        d1 = -1.797693134862316E+308D;
        double d3 = -1.797693134862316E+308D;
        localObject = new b_(null);
        b_ localb_3 = new b_(null);
        ((b_)localObject).a = -1.0D;
        localb_3.a = -1.0D;
        ListIterator localListIterator2 = paramList2.listIterator();
        label312:
        label323:
        do
        {
          do
          {
            d locald2;
            do
            {
              do
              {
                if (!localListIterator2.hasNext()) {
                  break label375;
                }
                locald2 = (d)localListIterator2.next();
                if (i != 0) {
                  break label323;
                }
                if (paramx.getInt(locald2.e()) != paramInt) {
                  break label312;
                }
                if (i != 0) {
                  break;
                }
              } while (paramn.getDouble(locald2) <= d1);
              d1 = paramn.getDouble(locald2);
              ((b_)localObject).c = locald2;
              ((b_)localObject).a = d1;
            } while ((i == 0) && ((!bool) || (paramn.getDouble(locald2) <= d3)));
            d3 = paramn.getDouble(locald2);
            localb_3.c = locald2;
            localb_3.a = d3;
            if ((i != 0) || (i != 0)) {
              break label394;
            }
            if (bool) {
              break label386;
            }
          } while (i != 0);
        } while (!bool);
        label375:
        paramList1.set(paramInt, localObject);
        label386:
        label394:
        paramList1.add(localb_3);
      }
    }
    double d2 = -1.797693134862316E+308D;
    ListIterator localListIterator1 = paramList1.listIterator();
    do
    {
      do
      {
        b_ localb_1;
        do
        {
          if (!localListIterator1.hasNext()) {
            break;
          }
          localb_1 = (b_)localListIterator1.next();
        } while (localb_1.a <= d2);
        d2 = localb_1.a;
        if (i == 0)
        {
          if ((i != 0) || (bool)) {
            break label482;
          }
          locald1 = localb_1.c;
        }
      } while (i != 0);
    } while (!bool);
    label482:
    return locald1;
  }
  
  int a(q paramq, x paramx, int paramInt1, int paramInt2, boolean paramBoolean, k paramk)
  {
    int n = m.b;
    boolean bool2 = m.a;
    if (n == 0) {
      if (paramq.l() == 0) {
        return m.a(paramq, paramx);
      }
    }
    d[] arrayOfd = paramq.u();
    int i = m.a(paramq, paramx);
    List localList = a(paramq, paramx, i);
    ArrayList localArrayList1 = new ArrayList();
    double d1 = -1.797693134862316E+308D;
    x localx = db.a(new int[paramq.j()]);
    int k = 0;
    if (n == 0)
    {
      if (i >= paramInt1)
      {
        d1 = a(arrayOfd, paramx, i, paramBoolean);
        a(paramq, paramx, localx);
      }
    }
    else {
      k = i;
    }
    n localn = paramq.C();
    ArrayList localArrayList3 = null;
    d locald = null;
    int m = -1;
    boolean bool1 = false;
    ListIterator localListIterator = localList.listIterator();
    while (localListIterator.hasNext())
    {
      ArrayList localArrayList4 = (ArrayList)localListIterator.next();
      localArrayList3 = a(localArrayList4);
      if (n == 0)
      {
        if (paramk == null) {
          ab.a(paramq, localArrayList4, localArrayList3, localn, paramBoolean);
        }
      }
      else
      {
        if (n != 0) {
          break label239;
        }
        if (!bool2) {
          break label217;
        }
      }
      ab.a(paramq, localArrayList4, localArrayList3, localn, paramBoolean, paramk);
      label217:
      a(localArrayList3, localn);
      label239:
      localArrayList1.add(c(localArrayList3, localn));
    }
    locald = a(localArrayList1, localArrayList3, localn, paramx, bool1, m);
    paramq.f(locald);
    m = paramx.getInt(locald.e());
    ArrayList localArrayList2 = a((ArrayList)localList.get(m));
    int j = a(paramq, localArrayList2, paramx, localList, i);
    if (j > i)
    {
      bool1 = true;
      if (n == 0)
      {
        if (j >= paramInt1)
        {
          if (n != 0) {
            break label397;
          }
          if (j <= paramInt2)
          {
            double d2 = a(arrayOfd, paramx, j, paramBoolean);
            if (n != 0) {
              break label397;
            }
            if (d2 > d1)
            {
              d1 = d2;
              k = j;
              a(paramq, paramx, localx);
            }
          }
        }
        i = j;
        if (n != 0) {
          break label418;
        }
      }
      label397:
      if (!bool2) {
        break label403;
      }
    }
    label403:
    label418:
    label464:
    label473:
    do
    {
      bool1 = false;
      localArrayList3 = a(localArrayList2);
      b(localArrayList3, localn);
      if (n == 0)
      {
        if (paramk == null) {
          ab.a(paramq, localArrayList2, localArrayList3, localn, paramBoolean);
        }
      }
      else
      {
        if (n != 0) {
          break label473;
        }
        if (!bool2) {
          break label464;
        }
      }
      ab.a(paramq, localArrayList2, localArrayList3, localn, paramBoolean, paramk);
      a(localArrayList3, localn);
      do
      {
        if (n != 0) {
          break label520;
        }
        if ((j < paramInt2) && (paramq.l() != 0)) {
          break;
        }
        a(paramq, arrayOfd);
        a(paramq, localx, paramx);
        paramq.a(localn);
      } while (n != 0);
    } while (bool2);
    label520:
    return k;
  }
  
  private static class b_
  {
    double a;
    d c;
    
    private b_() {}
    
    b_(ib.0 param0)
    {
      this();
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.a.ib

 * JD-Core Version:    0.7.0.1

 */